$primary: #1d75b0;
$secondary: #36D399;
$neutral: #F5F7FA;
$dark: #1D2939;
$light: #F9FAFB;
$gray-light: #F9FAFB;
$gray-medium: #E4E7EC;
$gray-dark: #98A2B3;

.ai-document-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 40px);
  background-color: $gray-light;
  
  .header {
    background-color: white;
    border-bottom: 1px solid $gray-medium;
    position: sticky;
    top: 0;
    z-index: 50;
    
    .container {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0.15rem 1rem;
      max-width: 100%;
      margin: 0 auto;
      
      .logo {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin-top: 5px;
        font-size: 14px;

        .logo-title {
          display: flex;
          align-items: center;
          gap: 10px;

          .document-edit-title {
            margin: 0px !important;
          }
        }
        
        i {
          font-size: 1.1rem;
          color: $dark;
        }
        
        h1 {
          font-size: 1.25rem;
          font-weight: 700;
          color: $dark;
          margin: 0;
        }
      }
      
      .ai-functions {
        display: flex;
        align-items: center;
        gap: 0.25rem;
        
        .btn {
          padding: 0.5rem 1rem;
          font-size: 0.875rem;
          border-radius: 0.375rem;
          border: 1px solid transparent;
          display: flex;
          align-items: center;
          gap: 0.5rem;
          cursor: pointer;
          transition: all 0.3s ease;
          
          i {
            font-size: 0.875rem;
          }
          
          &.btn-primary {
            background-color: $primary;
            color: white;
            
            &:hover {
              background-color: darken($primary, 5%);
            }
          }
          
          &:not(.btn-primary) {
            background-color: white;
            color: $dark;
            border-color: $gray-medium;
            
            &:hover {
              background-color: $gray-light;
            }
          }
        }
      }
      
      .utility-buttons {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        
     
      }

         .btn-icon {
          background: none;
          border: none;
          font-size: 1rem;
          color: $dark;
          cursor: pointer;
          padding: 0.5rem;
          border-radius: 50%;
          
          &:hover {
            color: $primary;
            background-color: rgba($primary, 0.1);
          }
        }
    }
  }
  
  .main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    margin-top: 75px;
    
    .sidebar {
      width: 16rem;
      background-color: white;
      border-right: 1px solid $gray-medium;
      overflow-y: auto;
      padding: 0px;
      margin-bottom: 0px;
      
      &.right-sidebar {
        border-right: none;
        width:400px;
        border-left: 1px solid $gray-medium;
      }
      
      .sidebar-section {
        padding: 1rem;
        border-bottom: 1px solid $gray-medium;
        
        h2, h3 {
          display: flex;
          align-items: center;
          gap: 0.5rem;
          font-weight: 600;
          color: $dark;
          margin-bottom: 0.75rem;
          
          i {
            color: $primary;
            font-size: 0.875rem;
          }
        }
        
        h2 {
          font-size: 0.875rem;
        }
        
        h3 {
          font-size: 0.875rem;
          margin-top: 0.5rem;
        }
      }
      
      .outline-tree {
        .outline-item {
          margin-bottom: 0.25rem;
          
          .outline-header {
            display: flex;
            align-items: center;
            padding: 0.375rem 0.75rem;
            border-radius: 0.375rem;
            cursor: pointer;
            font-size: 0.875rem;
            color: $dark;
            
            &:hover {
              background-color: $gray-light;
            }
            
            i {
              margin-right: 0.5rem;
              font-size: 0.625rem;
              transition: transform 0.2s ease;
              
              &.rotate-90 {
                transform: rotate(90deg);
              }
            }
          }
          
          .outline-children {
            padding-left: 1.5rem;
            margin-top: 0.25rem;
            
            .outline-child {
              padding: 0.25rem 0.75rem;
              border-radius: 0.375rem;
              font-size: 0.8125rem;
              cursor: pointer;
              
              &:hover {
                background-color: $gray-light;
                color: $primary;
              }
            }
          }
        }
      }
      
      .keywords {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        
        .keyword-tag {
          padding: 0.25rem 0.625rem;
          font-size: 0.75rem;
          background-color: rgba($primary, 0.1);
          color: $primary;
          border-radius: 1rem;
        }
      }
      
      .version-history {
        .version-item {
          padding: 0.5rem 0.75rem;
          border-radius: 0.375rem;
          cursor: pointer;
          font-size: 0.8125rem;
          
          &:hover {
            background-color: $gray-light;
          }
          
          .version-header {
            display: flex;
            justify-content: space-between;
            
            .version-name {
              font-weight: 500;
              color: $dark;
            }
            
            .version-time {
              color: $gray-dark;
              font-size: 0.75rem;
            }
          }
          
          .version-desc {
            color: $gray-dark;
            font-size: 0.75rem;
            margin-top: 0.25rem;
          }
        }
      }
      
      .recent-templates {
        .recent-item {
          display: flex;
          align-items: center;
          padding: 0.5rem;
          border-radius: 0.375rem;
          cursor: pointer;
          
          &:hover {
            background-color: $gray-light;
          }
          
          .recent-icon {
            width: 2.5rem;
            height: 2.5rem;
            border-radius: 0.375rem;
            background-color: rgba($primary, 0.05);
            display: flex;
            align-items: center;
            justify-content: center;
            
            i {
              color: $primary;
              font-size: 1rem;
            }
          }
          
          .recent-info {
            margin-left: 0.75rem;
            
            h4 {
              font-size: 0.75rem;
              font-weight: 500;
              color: $dark;
              margin: 0;
            }
            
            p {
              font-size: 0.625rem;
              color: $gray-dark;
              margin: 0.25rem 0 0;
            }
          }
        }
      }
    }
    
    .document-content {
      flex: 1;
      overflow-y: auto;
      padding: 0px; 
      background-color: $neutral;

      .document-paper-scroller{
        border-radius: 5px;
      }
      
      .document-paper { 
        width: 21cm;
        min-height: 29.7cm;
        margin: 0 auto; /* 水平居中 */ 
        box-sizing: border-box;
        overflow-y: auto;
        margin-top: 10px;
        
        .document-header {
          text-align: center;
          margin-bottom: 2rem;
          
          h1 {
            font-size: clamp(1.5rem, 3vw, 2.5rem);
            font-weight: 700;
            color: $dark;
            margin-bottom: 1rem;
          }
          
          .author {
            color: $gray-dark;
            margin-bottom: 1.5rem;
          }
          
          .divider {
            height: 1px;
            width: 8rem;
            background-color: $gray-medium;
            margin: 0 auto;
          }
        }
        
        .document-body {
          color: $dark;
          line-height: 1.6;
          
          h2 {
            font-size: 1.5rem;
            font-weight: 600;
            margin: 2rem 0 1rem;
          }
          
          h3 {
            font-size: 1.25rem;
            font-weight: 500;
            margin: 1.5rem 0 0.75rem;
          }
          
          p {
            margin-bottom: 1rem;
          }
          
          ol, ul {
            margin-bottom: 1rem;
            padding-left: 1.5rem;
            
            li {
              margin-bottom: 0.5rem;
            }
          }
        }
        
        .document-footer {
          display: flex;
          justify-content: space-between;
          align-items: center;
          padding-top: 1.5rem;
          margin-top: 2rem;
          border-top: 1px solid $gray-medium;
          font-size: 0.875rem;
          
          .word-count {
            color: $gray-dark;
          }
          
          .document-actions {
            display: flex;
            gap: 1rem;
            
            .btn-link {
              background: none;
              border: none;
              color: $primary;
              font-size: 0.875rem;
              display: flex;
              align-items: center;
              gap: 0.25rem;
              cursor: pointer;
              padding: 0;
              
              i {
                font-size: 0.875rem;
              }
              
              &:hover {
                opacity: 0.8;
              }
            }
          }
        }
      }
    }
  }
}
